/**
 * $Id: LoginFailureHandler.java 12 2010-11-02 15:33:09Z feigme $
 */
package com.iary.security;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;

public class LoginFailureHandler implements AuthenticationFailureHandler {

	public void onAuthenticationFailure(HttpServletRequest request,
			HttpServletResponse response, AuthenticationException exception)
			throws IOException, ServletException {
		response.setContentType("application/json;charset=UTF-8");
		String str = "E5";
		response.getWriter().write("{\"error\":\"" + str + "\"}");
	}

}
